
angular.module("myApp", [])
.run(function ($http) {
        $http.defaults.headers.common['Access-Control-Allow-Origin'] = "*";
        $http.defaults.headers.common['Access-Control-Allow-Origin'] = "http://localhost:2701";
        $http.defaults.headers.common['Access-Control-Allow-Methods'] = "GET, POST, PUT, DELETE, OPTIONS";
        $http.defaults.headers.common['Access-Control-Allow-Headers'] = "Authorization";
    })
.config(['$httpProvider', function ($httpProvider) {
    $httpProvider.defaults.useXDomain = true;
    delete $httpProvider.defaults.headers.common['X-Requested-With'];
}
])
.service("getQnJsonDataService",function($http)
{
    return {
        getData: function () {
            return $http.jsonp('http://www.runoob.com/try/angularjs/data/Customers_JSON.php?callback=JSON_CALLBACK');
             //return $http.get("/aa.json", { reponseType: "json" });
        }
    }
})
.controller("questionList", function ($scope, getQnJsonDataService) {
        getQnJsonDataService.getData().success(function(result) {
            $scope.questionData = result.data;
    });

})

//前台代码
    <div id="categories" class="col-xs-3" ng-app="myApp"  ng-controller="questionList" >
        list

        <ul class="nav navbar-nav" ng-repeat="r in questionData" >
            <li>{{  r.r_q_id }}</li>
            <li ng-bind="r.r_q_title">{{r.r_q_title}}</li>
            <li>{{r.r_q_title}}</li>
        </ul>
    </div>
